const Koa = require('Koa')
const app = new Koa()
const json = require('koa-json')
const bodyParser = require('koa-bodyparser')
const router = require('koa-router')()
const cors = require('koa2-cors')
const abnormal = require('./config/abnormal')
//处理全局异常
app.use(cors())
app.use(json())
app.use(bodyParser())
app.use(abnormal)
//注册登录
const login = require('./router/login/login')
const infor = require('./router/merchant-infor/infor')
const dish = require('./router/dish-manage/dishinfor')
const order = require('./router/order/order')
const code = require('./router/QRcode/QRcode')
//配置路由接口
router.use('/api',login)
router.use('/api',infor)
router.use('/api',dish)
router.use('/api',order)
router.use('/api',code)
//启动路由
app.use(router.routes()).use(router.allowedMethods())

app.listen(5000);
console.log("success");